package es.aa.android.cartomatic.customview;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.RelativeLayout;
import android.widget.TextView;
import es.aa.android.cartomatic.R;


public class mSimpleHeader extends RelativeLayout {

    private TextView title;
    private TextView count;

    public mSimpleHeader(Context context, String title, String count) {
        super(context);
        initView(context);
        setTitle(title);
        setCount(count);
    }

    private void initView(Context context) {
        LayoutInflater.from(context).inflate(R.layout.simple_header, this, true);
        title = (TextView) findViewById(R.id.textViewSimpleHeader);
        count = (TextView) findViewById(R.id.textViewSimpleHeaderCount);
    }

    private void setTitle(String text) {
        title.setText(text);
    }

    private void setCount(String num) {
        if (num == null) {
            count.setVisibility(View.INVISIBLE);
        } else {
            count.setText(num + " mas");
        }
    }

}
